<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS3——线性渐变、径向渐变</title>
    <style>
        .box {
            float: left;
            overflow: hidden;
            width: 100px;
            height: 100px;
            background: #1272cc;
            margin: 15px;
        }

        /* --- 线性渐变、径向渐变 */

        /* 线性渐变，按方向，默认下到上 */
        .linear {
            background: linear-gradient(yellow, orange, green);
        }
        /* 线性渐变，按方向，从右到左 */
        .linear_left {
            background: linear-gradient(to left, yellow, orange, green);
        }
        /* 线性渐变，按角度 */
        .linearDeg {
            background: linear-gradient(60deg, yellow, orange, green);
        }
        /* 径向渐变，圆形默认 */
        .radial {
            background: radial-gradient(yellow, orange, green);
        }
        /* 径向渐变，椭圆形 */
        .radial_ellipse {
            background: radial-gradient(ellipse, yellow, orange, green);
        }

    </style>
</head>

<body>
    <div class="box linear"></div>
    <div class="box linear_left"></div>
    <div class="box linearDeg"></div>
    <div class="box radial"></div>
    <div class="box radial_ellipse"></div>
</body>

</html>